package com.example.demo.controller;

import com.example.demo.entity.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: RIKU
 * \* Date: 2020/5/25
 * \* Time: 12:56
 * \* To change this template use File | Settings | File Templates.
 * \* Description: //TODO
 * \
 */
@Controller
public class HelloController {

    /**
     * ${}：可以取环境变量中的值，只是取值
     * #{}：字符串做""，数值不加
     */

    @Value("${neu.className}")
    private String className;
    @Value("${neu.count}")
    private int count;
    @Autowired
    private Teacher teacher;

    @RequestMapping("hello")
    @ResponseBody  //json格式返回
    public String hello(){
        return "课程名称：" + className + "，上课人数：" + count + "，教师信息：" + teacher + "，测试语句：" + "Hello, SpringBoot!";
    }
}
